package converter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import repository.SearchRepository;

import command.SearchForm;

@Component
public class SearchFormConverter implements Converter<String, SearchForm>{
	
	private SearchRepository searchRepository;
	
	@Autowired
	public SearchFormConverter(SearchRepository searchRepository) {
		this.searchRepository = searchRepository;
	}

	@Override
	public SearchForm convert(String source) {
		return searchRepository.get(Integer.valueOf(source));
	}

}
